home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 September
/
EnigmA AMIGA RUN 10 (1996)(G.R. Edizioni)(IT)[!][issue 1996-09][EARSAN CD XI].iso
/
aweb
/
awebftp.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-03-31
|
5KB
|
166 lines
/* AwebFTP FTP plug-in
Version 1.0e
By Josef Faulkner (panther@gate.net) IRC: Josef
Description:
¯¯¯¯¯¯¯¯¯¯¯¯
This plugin will allow you to do inline FTPing of files on the net,
without the need to call an external FTP program (except FTPMount, which
is transparent). It will distinguish between a directory and a file, and
act accordingly.
Features:
¯¯¯¯¯¯¯¯¯
o Fast reaction, since FTPMount does a lot of cacheing of dirs
o Asyncronous download (thanks to Aweb), you can continue browsing
while it downloads, and Aweb will inform you when the transfer
has completed!
o Brings up a requestor to ask what you want to save as
Requirements:
¯¯¯¯¯¯¯¯¯¯¯¯¯
FTPMount version 8 must be installed and running (version 7 wont work)
available on Aminet:
FTPMount-0.8.lha comm/tcp 109K Mounts FTP sites
Installation:
¯¯¯¯¯¯¯¯¯¯¯¯¯
1) Put this script in the same directory that the Aweb executable is in.
2) Set Aweb to the following settings:
----------------------------------------------
Network 3: External Programs
ftp:
Command: sys:rexxc/rx
Arguments: awebftp.rexx %s %s %s <--- *** NOTE different in this vers ***
----------------------------------------------
3) Set your preferences for this script below:
Known Bugs:
¯¯¯¯¯¯¯¯¯¯¯
FTPMount has a bug with some linked directories. ftp://ftp.netcom.com/ is
an example of this. If you know how to solve this problem, let me know :)
*/
savedir='RAM:' /* Default directory to download to */
if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then exit 20
vers='1.0e'
parse arg server' 'file' 'screen
if server='about' then do
end
else do
if right(server,1)~='/' then server=server'/'
if length(file)>0 then do
filebk=file
dir=''
do until index(filebk,'/')=0
parse var filebk dirbk'/'filebk
dir=dir||dirbk'/'
end
file=filebk
url='ftp://'server||dir||file
end
else url='ftp://'server
address command 'delete t:awebftp#? >NIL:'
tmpfile='t:awebftp'time(S)'.html'
if exists(url) then do
info=statef(url)
type=word(info,1)
size=word(info,2)
select
when type='DIR' then do
address command 'list 'url' lformat "%n %l %d" >t:awebftp.tmp'
call open(1,'t:awebftp.tmp',r)
call open(2,tmpfile,w)
call writeln(2,'<html><head><title>'url'</title></head><body><pre>')
call writeln(2,'<h2>Directory of 'url'</h2>')
call writeln(2,'<hr>Size Name Date<hr>')
do until eof(1)
text=readln(1)
if strip(text)~='' then do
parse var text fname' 'size' 'date
if right(url,1)~='/' then url=url'/'
lurl=url||fname
if length(fname)>25 then ename=left(fname,25)||'</a>'
else ename=fname||'</a>'
if upper(word(text,2))='DIR' then do
call writeln(2,right(size,10)' <a href="'lurl'">'left(ename,30,' ')||right(date,10))
end
else do
call writeln(2,left(size,10)' <a href="'lurl'">'left(ename,30,' ')||right(date,10))
end
end
end
call writeln(2,'</pre><hr>AwebFTP v'vers' by <a href="mailto:panther@gate.net">Josef Faulkner</a>.')
call writeln(2,'</body></html>')
call close(1)
call close(2)
address AWEB.1 'open file://localhost/'tmpfile
end
when type='FILE' then do
if open(11,url,r) then do
call close(11)
address command 'requestchoice "AWebFTP" "View or Save 'file'?" "View|Save|Cancel" pubscreen="'screen'" >t:awebftpchoice.tmp'
call open(1,'t:awebftpchoice.tmp',r)
text=readln(1)
call close(1)
select
when text=0 then do
call putawebmsg('Transfer aborted.')
end
when text=1 then do
call putawebmsg('Downloading 'url' to view in Aweb.')
address command 'copy 'url' 'tmpfile
address AWEB.1 'open file://localhost/'tmpfile
end
when text=2 then do
address command 'requestfile drawer='savedir' file='file' pubscreen='screen' >'tmpfile
call open(1,tmpfile,r)
text=readln(1)
call close(1)
if left(text,7)~='no more' then do
call putawebmsg('Downloading 'file' ('size' bytes).<br> You may resume using Aweb, and a message will appear when transfer is complete.')
address command 'copy 'url' 'text
call putawebmsg('Download of 'file' to 'text' complete.')
end
else do
call putawebmsg('Transfer aborted.')
end
end
otherwise do
call putawebmsg('Strange Arexx bug. Inform <a href="mailto:panther@gate.net">author</a> of AwebFTP bug #2-'text)
exit
end
end
end
else do
call putawebmsg('Sorry, could not open 'url' for read access.')
end
end
otherwise do
putawebmsg('Strange Arexx bug. Inform <a href="mailto:panther@gate.net">author</a> of AwebFTP bug #1-'type)
exit
end
end
end
else do
call putawebmsg('Sorry, 'url' doesn''t exist.')
end
end
exit
PUTAWEBMSG: procedure
parse arg text
address command 'delete t:awebmsg#?.html >NIL:'
fname='t:awebmsg'time(S)'.html'
call open(4,fname,w)
call writeln(4,'<html><head><title>AwebFTP Message</title></head><body>')
call writeln(4,'<h3>'text'</h3>')
call writeln(4,'</body>')
call close(4)
address AWEB.1 'OPEN file://localhost/'fname
return